<div class="bs-callout bs-callout-info">
    <h4>Edit banner</h4>
    <p><a href="<?php echo base_url()?>admin/banner">+ Back</a></p>
</div>

<form class="form-horizontal" role="form" method="POST">
    <div class="form-group">
        <label for="languageCode" class="col-sm-8 control-label">Language</label>
        <div class="col-sm-4">
            <select id="languageCode" name="languageCode" class="form-control" onchange = "redirectlink('<?php echo base_url()."admin/banner/editLanguage/".$data['bannerId'].'/';?>'+ this.value);" >
                <?php
                    foreach($languages as $key=>$value){
                ?>
                <option value="<?php echo $value['languageCode']?>" <?php if($value['languageCode'] == $data['languageCode']) echo 'selected';?> ><?php echo $value['languageName']?></option>
                <?php
                    }
                ?>
            </select>
        </div>
    </div>
    
    <div class="form-group">
        <label for="image" class="col-sm-2 control-label">Image</label>
        <div class="col-sm-8">
            <input type="text" class="form-control" id="image" placeholder="Image" name="image" required="true" value="<?php echo $data['image'];?>" />
        </div>
        <div class="col-sm-2">
            <input type="button" id="btnSelectImg" class="btn btn-primary" value="Browse server" />
        </div>
    </div>
    
    <div class="form-group">
        <label for="line1" class="col-sm-2 control-label">Line 1</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" id="line1" placeholder="Line1" name="line1" required="true" value="<?php echo $data['line1'];?>" />
        </div>
    </div>
    
    <div class="form-group">
        <label for="line2" class="col-sm-2 control-label">Line 2</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" id="line2" placeholder="Line2" name="line2" required="true" value="<?php echo $data['line2'];?>" />
        </div>
    </div>
    
    <div class="form-group">
        <label for="line3" class="col-sm-2 control-label">Line 3</label>
        <div class="col-sm-10">
            <textarea class="form-control" id="line3" placeholder="Line3" name="line3" required="true"><?php echo $data['line3'];?></textarea>
        </div>
    </div>
    
    <div class="form-group">
        <label for="number" class="col-sm-2 control-label">Number</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" id="number" placeholder="Number" name="number" required="true" value="<?php echo $data['number'];?>" />
        </div>
    </div>
    
    
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-primary">Save</button>
        </div>
    </div>
</form>

<script type="text/javascript">
function redirectlink(url){
    window.location.href=url;
}
    $(document).ready(function () {
        $("#btnSelectImg").click(function () {
            var finder = new CKFinder();
            finder.selectActionFunction = function (fileUrl) {
                $('#image').val(fileUrl);
            };
            finder.popup();
        });
    });
 </script> 